package be.one.paq.service.impl;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import be.one.paq.model.User;
import be.one.paq.repository.impl.GenericJpaRepository;
import be.one.paq.service.IUserService;

@Repository
@Service("userService")
@Configurable(preConstruction = true)
public class UserService extends GenericJpaRepository<Integer, User> implements IUserService {

	@PersistenceContext
	transient EntityManager entityManager;
	
	@PostConstruct
	public void init() {
		super.setEntityManager(entityManager);
	}
	
	@PreDestroy
	public void destroy() {		
	}
	
	/* (non-Javadoc)
	 * @see be.one.paq.service.impl.IUserService#persist(be.one.paq.model.User)
	 */
	@Override
	public void persist(User entity) {
		// TODO Auto-generated method stub
		super.persist(entity);
	}

	/* (non-Javadoc)
	 * @see be.one.paq.service.impl.IUserService#remove(be.one.paq.model.User)
	 */
	@Override
	public void remove(User entity) {
		// TODO Auto-generated method stub
		super.remove(entity);
	}

	/* (non-Javadoc)
	 * @see be.one.paq.service.impl.IUserService#merge(be.one.paq.model.User)
	 */
	@Override
	public User merge(User entity) {
		// TODO Auto-generated method stub
		return super.merge(entity);
	}

	/* (non-Javadoc)
	 * @see be.one.paq.service.impl.IUserService#findById(java.lang.Integer)
	 */
	@Override
	public User findById(Integer id) {
		// TODO Auto-generated method stub
		return super.findById(id);
	}

	/* (non-Javadoc)
	 * @see be.one.paq.service.impl.IUserService#findAll()
	 */
	@Override
	public List<User> findAll() {
		// TODO Auto-generated method stub
		return super.findAll();
	}

}
